import { type RouteRecordRaw } from 'vue-router'

/* 引入视图 */
import loginView from '@/views/home/LoginView.vue'
import indexView from '@/views/home/IndexView.vue'
import homeView from '@/views/home/HomeView.vue'
import demoEchartsView from '@/views/demo/DemoEchartsView.vue'
import demoListView from '@/views/demo/DemoListView.vue'
import demoCanvasView from '@/views/demo/DemoCanvasView.vue'
import userIndexView from '@/views/user/IndexView.vue'
import authorityIndexView from '@/views/authority/IndexView.vue'

const constantRoutes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: loginView.name!,
    component: loginView,
    meta: {
      keepAlive: true,
      isLeaf: true,
    },
  },
  {
    path: '/index',
    name: indexView.name!,
    component: indexView,
    children: [
      {
        path: '/home',
        name: homeView.name!,
        component: homeView,
        meta: {
          keepAlive: true,
          isLeaf: false,
        },
      },
      {
        path: '/demoEcharts',
        name: demoEchartsView.name!,
        component: demoEchartsView,
        meta: {
          keepAlive: true,
          isLeaf: true,
        },
      },
      {
        path: '/demoList',
        name: demoListView.name!,
        component: demoListView,
        meta: {
          keepAlive: true,
          isLeaf: true,
        },
      },
      {
        path: '/demoCanvas',
        name: demoCanvasView.name!,
        component: demoCanvasView,
        meta: {
          keepAlive: true,
          isLeaf: true,
        },
      },
      {
        path: '/indexView',
        name: userIndexView.name!,
        component: userIndexView,
        meta: {
          keepAlive: true,
          isLeaf: true,
        },
      },
      {
        path: '/authorityList',
        name: authorityIndexView.name!,
        component: authorityIndexView,
        meta: {
          keepAlive: true,
          isLeaf: true,
        },
      },
    ],
  },
]

export default constantRoutes
